The TableTester application is a sample applicatioon with source code for demonstrating programming techniques for NSTableView.  It is meant to accompany a series of articles for MacTech magazine, but the example source should stand on its own.

This application will "grow" as the series progresses, until I run out of techniques to illuminate or until I run out of room for tabs, whichever comes sooner.  :-)

-------------

A few minor differences are found in the running source code from the sample code in the MacTech articles.  Primarily, this is to simplify the listings: the listings simulate a single-table window, but the actual tester application has a number of tab views, each containing a table.  The application logic to handle this is primarily found in AppController.m.

In order to find the currently displayed table from "global" methods such as delete:, we get the current tab view item's initialFirstResponder outlet.  (This is set up in Interface Builder; it's kind of tricky because you have to use the Text view of your objects.)  

The application's file is a mess!  Well, it's set up that way on purpose, because the goal was to keep the code as simple as possible.  So we have separate objects for a table view's data sources (softwareSource, peopleSource) and delegates (AttributedDelegate, StretchingDelegate, WrappingDelegate, EditingDelegate) -- usually they are the same object -- and we have nib references to the actual NSMutableArrays (softwareArray, peopleArray) that hold the data, so that we can separate the data code from the way that the data is loaded.  This is probably not how a real application would do this!

Currently, when you open the nib with Interface Builder, it will complain about inconsistencies.  This is becuase the NSMutableArrays declared in the nib are inconsistent with their actual run-time classes (NSCFArray).  Don't worry about this.


-------------

TableTester source code is Copyright 2002 Daniel J. Wood.  Because the code is comprised of small generic snippets, many inspired by code samples posted online by others, I do not place any adaptation or distribution restriction on individual pieces of code.   Feel free to use these snippets in your program without restriction.

TableTester icon was created by Mike Matas and is copyright 2002 Karelia Software, LLC.

The "people" database is a derivative of the "Make Believe Customer List" found at www.bearriver.com, used by permission.



Dan Wood
dwood@karelia.com
